home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / off / off.lha / OFFLIB / ADDPROP.C next >
Encoding:
C/C++ Source or Header  |  1992-11-30  |  1.2 KB  |  60 lines

  1.  
  2.  
  3. /*
  4.  *
  5.  * Description
  6.  *    Add property structure to OFF property list.
  7.  *
  8.  * Output
  9.  *    OFFAddProperty returns a pointer to the newly-created and
  10.  *    initialized property structure.
  11.  *
  12.  * Input
  13.  *    Obj        Pointer to object to which property is to be added.
  14.  *
  15.  * Diagnostics
  16.  *    Returns NULL if unsuccessful malloc'ing the property structure.
  17.  *
  18.  * Author
  19.  *    Randi J. Rost
  20.  *    Digital Equipment Corp.
  21.  *    Workstation Systems Engineering
  22.  *    Palo Alto, CA
  23.  *
  24.  * History
  25.  *    17-Nov-86    Created
  26.  */
  27.  
  28. #include <stdio.h>
  29. #include "off.h"
  30.  
  31. OFFProperty *OFFAddProperty(Obj)
  32.     OFFObjDesc    *Obj;    /* Pointer to object */
  33.  
  34.     {
  35.     OFFProperty    **ppProp;
  36.     OFFProperty    *newProp;
  37.  
  38.     ppProp = &(Obj->FirstProp);
  39.     while (*ppProp != NULL) ppProp = &((*ppProp)->NextProp);
  40.  
  41.     newProp = (OFFProperty *) malloc(sizeof(OFFProperty));
  42.  
  43.     if (newProp == NULL)
  44.     {
  45.     fprintf(stderr, "OFFAddProperty: malloc failed\n");
  46.     return(NULL);
  47.     }
  48.  
  49.     *ppProp = newProp;
  50.     newProp->PropName[0] = '\0';
  51.     newProp->PropType = OFF_UNKNOWN_TYPE_DATA;
  52.     newProp->PropFileName[0] = '\0';
  53.     newProp->DataFormat[0] = '\0';
  54.     newProp->PropCount = 0;
  55.     newProp->PropData = NULL;
  56.     newProp->NextProp = NULL;
  57.  
  58.     return(newProp);
  59.     }
  60.